package org.work;
import java.sql.*;
import org.model.Xsb;
public class DBConn {
	Connection conn;
	PreparedStatement pstmt;
	public DBConn(){
		try {
			Class.forName("com.mysql.jdbc.Driver");
			conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/XSCJ","root","root");
			
		}catch(Exception e){
			e.printStackTrace();
		}

	}
	public boolean save(Xsb xs){
		try{
			pstmt=conn.prepareStatement("insert into XSB values(?,?,?,?,?,?)");
			pstmt.setString(1,xs.getXh());
			pstmt.setString(2,xs.getXm());
			pstmt.setByte(3, xs.getXb());
			pstmt.setString(4, xs.getZy());
			pstmt.setDate(5, xs.getCssj());
			pstmt.setString(6, xs.getBz());
			pstmt.executeUpdate();
			return true;
			
	}catch(Exception e){
		e.printStackTrace();
		return false;
	}
}
}
